Method and apparatus for performing intra-prediction using adaptive filter

ABSTRACT

Provided is a method and apparatus for performing intra-prediction using an adaptive filter. The method for performing intra-prediction includes the steps of: determining whether or not to apply a first filter for a reference pixel value on the basis of information of a neighboring block of a current block; applying the first filter for the reference pixel value when it is determined to apply the first filter; performing intra-prediction on the current block on the basis of the reference pixel value; determining whether or not to apply a second filter for a prediction value according to each prediction mode of the current block, which is predicted by the intra-prediction performance on the basis of the information of the neighboring block; and applying the second filter for the prediction value according to each prediction mode of the current block when it is determined to apply the second filter.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation application of U.S.application Ser. No. 16/725,624, filed Dec. 23, 2019, which is acontinuation of Ser. No. 16/127,892, filed on Sep. 11, 2018, now U.S.Pat. No. 10,560,721, which is a continuation of U.S. application Ser.No. 16/057,459, filed on Aug. 7, 2018, now U.S. Pat. No. 10,623,769,which is a continuation of U.S. application Ser. No. 15/798,024, filedon Oct. 30, 2017, now U.S. Pat. No. 10,075,734, which is a continuationof U.S. application Ser. No. 15/433,890, filed Feb. 15, 2017, now U.S.Pat. No. 9,838,711, which is a continuation of U.S. application Ser. No.14/823,638, filed on Aug. 11, 2015, now U.S. Pat. No. 9,661,345, whichis a continuation of U.S. application Ser. No. 13/640,014, filed on Oct.8, 2012, now U.S. Pat. No. 9,549,204, which is a 371 U.S. National phaseof PCT/KR2011/002514, filed on Apr. 4, 2011, each of which isincorporated herein by reference in its entirety.

TECHNICAL FIELD

The present invention relates to video coding, and more particularly, toa method and apparatus for performing intra-prediction by applying anadaptive filter to the surrounding pixel values of a block to bepredicted or the predicted pixel values of a current block.

BACKGROUND ART

With the recent advent of digital TV, etc., technology in thebroadcasting TV and home entertainment fields are abruptly beingdeveloped. Technology of the fields is being commercialized by thestandardization of video compression technology. For video compression,an ITU-T (International Telecommunications Union-Telecommunication) H.263 standard is being widely used. MPEG-4 which is the next standard ofMPEG (Motion Picture Experts Group) is being used for Internet-basedvideo applications.

After the H. 263 standard was completed, ITU-T VCEG (Video CodingExperts Group) has devoted itself to achieve a short-term target foradding additional characteristics to the H. 263 standard and a long-termtarget for developing a new standard for visual communication of a lowbit rate. In the year of 2001, JVT (Joint Video Team) consisting of theexperts of MPEG and VCEG was constructed, and the JVT has performed astandardization task of ITU-T H. 264/MPEG-4 part 10 which is a newstandard for the coding of video. The H. 264 standard may also be calledAVC (Advanced Video Coding). The technological target of the H. 264/AVCis for the significant improvement of coding efficiency, codingtechnology robust to loss and error, network-friendly coding technology,low latency capability, accurate match decoding, and so on.

Most of surrounding pixels within video have similar values. The sameprinciple applies to 4×4 blocks or 16×16 blocks which are a minimumblock size of the H. 264/AVC standard. Prediction for the video may beperformed using the likeness between inter-block values as describedabove, and a difference between the video and an original video can beencoded. This is called intra-prediction. The efficiency of video codingcan be increased by intra-prediction.

Furthermore, in performs intra-prediction, a filter may be appliedbefore the intra-prediction is performed. In typical cases, whenintra-prediction is performed in the H. 264/AVC standard, a filter isapplied to reference pixel values, and the values to which the filterhas been applied are used for the intra-prediction. However, theperformance of video coding may be increased when the intra-predictionis performed without applying the filter rather than when theintra-prediction is performed after the filter is applied, according tocircumstances.

Accordingly, there may be proposed a method of determining whether toapply a filter when performing intra-prediction.

SUMMARY OF INVENTION Technical Problem

An object of the present invention is to provide a method and apparatusfor performing intra-prediction by applying an adaptive filter tosurrounding pixel values of a block to be predicted or the predictedpixel values of a current block in video encoding. More particularly,after an adaptive filter (i.e., a pre-filter) is applied to referencepixel values of a current block for performing intra-prediction,prediction is performed. Furthermore, a residual signal is calculatedafter applying an adaptive filter (i.e., a post-filter) to the pixelvalues of a predicted current block.

Technical Solution

In an aspect, there is provided a method of performing intra-prediction.The method of performing intra-prediction includes determining whetherto apply a first filter to a reference pixel value based on informationabout surrounding blocks of a current block, if, as a result of thedetermination, the first filter is determined to be applied, applyingthe first filter to the reference pixel values, performingintra-prediction for the current block based on the reference pixelvalue, determining whether to apply a second filter to a predictionvalue for each prediction mode of the current block, predicted byperforming the intra-prediction based on the information about thesurrounding blocks, and if, as a result of the determination, the secondfilter is determined to be applied, applying the second filter to theprediction values for each prediction mode.

Whether to apply the first filter may be determined based on theprediction mode of the current block determined based on the informationabout the surrounding blocks.

Whether to apply the first filter may be determined based on the size ofthe current block.

Whether to apply the first filter may be previously designated based onthe prediction mode of the current block and the size of the currentblock.

Whether to apply the first filter may be determined based on whether thesurrounding blocks have been subjected to intra-frame coding orinter-frame coding.

The first filter may be at least any one of a 3-tap filter and a 2-tapfilter.

Whether to apply the second filter may be determined based on theprediction mode of the current block determined based on the informationabout the surrounding blocks.

Whether to apply the second filter may be determined based on the sizeof the current block.

Whether to apply the second filter may be determined based on whetherthe surrounding blocks have been subjected to intra-frame encoding orinter-frame encoding.

The second filter may be applied to prediction values of pixels adjacentto the boundary of the reference pixel value.

The second filter may be at least any one of a 3-tap filter and a 2-tapfilter.

In another aspect, there is a provided encoder. The encoder includes aprocessor and memory connected to the processor and configured to storepieces of information for driving the processor. The processor isconfigured to determine whether to apply a first filter to a referencepixel value based on information about surrounding blocks of a currentblock, if, as a result of the determination, the first filter isdetermined to be applied, apply the first filter to the reference pixelvalue, perform intra-prediction for the current block based on thereference pixel value, determine whether to apply a second filter to aprediction value for each prediction mode of the current block,predicted by performing the intra-prediction based on the informationabout the surrounding blocks, and if, as a result of the determination,the second filter is determined to be applied, apply the second filterto the prediction value for each prediction mode.

In yet another aspect, there is a provided decoder. The decoder includesa processor and memory connected to the processor and configured tostore pieces of information for driving the processor. The processor isconfigured to determine whether to apply a first filter to a referencepixel value based on information about surrounding blocks of a currentblock, if, as a result of the determination, the first filter isdetermined to be applied, apply the first filter to the reference pixelvalue, perform intra-prediction for the current block based on thereference pixel value, determine whether to apply a second filter to aprediction value for each prediction mode of the current block,predicted by performing the intra-prediction based on the informationabout the surrounding blocks, and if, as a result of the determination,the second filter is determined to be applied, apply the second filterto the prediction value for each prediction mode.

Advantageous Effects

The performance of coding is improved by effectively predicting aluminance or chrominance signal block to be encoded.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of an encoder according to the H. 264/AVC(Advanced Video Coding) standard.

FIG. 2 is a block diagram of a decoder according to the H. 264/AVCstandard.

FIG. 3 is a diagram showing an example of labeled prediction samples ina 4×4 luma prediction mode.

FIGS. 4A to 4I are a diagram showing 9 kinds of prediction modes withinthe 4×4 luma prediction mode.

FIG. 5 is a diagram showing an example of a method of applying a filterbefore intra-prediction is performed.

FIG. 6 is a diagram showing an embodiment of a proposed method ofperforming intra-prediction using an adaptive filter.

FIG. 7 is a diagram showing an example in which a filter is applied to aprediction value according to the proposed method of performingintra-prediction using the adaptive filter.

FIG. 8 is a block diagram of an encoder and a decoder in which theembodiments of the present invention are implemented.

MODE FOR INVENTION

Hereinafter, embodiments of the present invention are described indetail with reference to the accompanying drawings in order for thoseskilled in the art to be able to readily implement the presentinvention. However, the present invention may be implemented in variousdifferent ways and are not limited to the following embodiments. Inorder to clarify a description of the present invention, parts notrelated to the description are omitted, and similar reference numbersare used throughout the drawings to refer to similar parts. Furthermore,a description of parts which can be readily understood by those skilledin the art is omitted.

Furthermore, when it is said that any part “includes (or comprises)” anyelement, it means that the corresponding part may further include otherelements unless otherwise described without excluding the elements.

FIG. 1 is a block diagram of an encoder according to the H. 264/AVC(Advanced Video Coding) standard.

Referring to FIG. 1 , the encoder includes two kinds of data flow paths.One of them is a forward path, and the other thereof is a reconstructionpath.

First, the forward path is described. Encoding is performed for an inputframe F_(n) for each macroblock. The macroblock has the size of 16×16pixels in an original video. Intra-prediction or inter-prediction isperformed for each input frame. In the intra-prediction, prediction isperformed using a likeness between inter-block values within the frame,and a difference between the original video and a relevant video isencoded. In the inter-prediction, prediction is performed using alikeness between inter-block values between frames, and a differencebetween the original video and a relevant video is encoded. At the timeof the intra-prediction or the inter-prediction, P (i.e., a predictionmacroblock) is formed on the basis of the reconstructed frame. At thetime of the intra-prediction, the prediction macroblock P may be formedfrom samples within a previously encoded current frame, a decodedcurrent frame, or a reconstructed current frame uF_(n)′. When theprediction macroblock P is formed from the reconstructed current frame,unfiltered samples may be used. At the time of the inter-prediction, theprediction macroblock P may be formed from one or more reference framesthrough motion compensation or motion prediction. In FIG. 1 , it isassumed that the reference frame is a previously encoded frame F_(n-1)′.However, the present invention is not limited thereto, and eachprediction macroblock may be formed from a previous 1 frame or previous2 frames already encoded or reconstructed, or a subsequent frame orsubsequent 2 frames.

P is subtracted from the current macroblock in order to generate aresidual or different macroblock D_(n). The macroblock D_(n) istransformed (T) using a block transform and quantized (Q), thusgenerating X. X is a set of encoded coefficients. The encodedcoefficients are reordered and then subjected to entropy coding. Theentropy-coded coefficients form a compressed bit stream, along withinformation necessary to decode the macroblock. The compressed bitstream is sent to a Network Abstraction Layer (NAL) for transmission orstorage.

The reconstruction path is described below. The quantized macroblockcoefficients X are decoded in order to generate a reconstructed framewhich is used to encode other macroblocks. X are inverse quantized (Q⁻¹)and then inverse transformed (T⁻¹), thus generating a macroblock. Thedifference macroblock D_(n)′ generated in the reconstruction path is notthe same as the difference macroblock D_(n) generated in the forwardpath. Loss is generated because of the quantization, and thus themacroblock D_(n)′ may have a distorted form of D_(n). The predictionmacroblock P is added to the macroblock, and a reconstruction macroblockuF_(n)′ is generated. The reconstruction macroblock uF_(n)′ may alsohave a distorted form of the original macroblock Fn. In order to reduceblocking distortion for the reconstruction macroblock uF_(n)′, a filtermay be applied. A reconstructed frame may be formed from a plurality ofreconstruction macroblocks to which the filter has been applied.

FIG. 2 is a block diagram of a decoder according to the H. 264/AVCstandard.

Referring to FIG. 2 , the decoder receives a compressed bit stream froman NAL. The received data is subjected to entropy decoding in order togenerate a set of quantized coefficients X and then reordered. Inversequantization and inverse transform are performed for the quantizedcoefficients X, thereby generating D_(n)′. The decoder generates thesame prediction macroblock P as a prediction macroblock, generated at anencoder, using header information decoded from the bit stream. uF_(n)′is generated by adding D_(n)′ to P, and uFn′ may experience a filter,thereby generating a decoded macroblock.

Intra-prediction is described below.

When the intra-prediction is performed for a block (or a macroblock), aprediction block (or a macroblock) P may be formed on the basis ofencoded blocks (or macroblocks) or reconstructed blocks (ormacroblocks). P is subtracted from an original video, and a differencefrom which P has been subtracted is encoded and then transmitted. Theintra-prediction may be performed according to a luma prediction mode ora chroma prediction mode. In the luma prediction mode, theintra-prediction may be performed in the unit of a 4×4 sub-block size ora 16×16 macroblock size. A total of 9 additional prediction modes existin the 4×4 luma prediction mode, and a total of 4 additional predictionmodes exist in the 16×16 luma prediction mode. The unit in which theintra-prediction is performed is not limited to the sub-block or themacroblock, but may be performed using various sizes as the unit. Theunit of a pixel in which the intra-prediction is performed may be calleda Coding Unit (CU) or a Prediction Unit (PU). The size of the CU or thePU may be the same as the size of a sub-block or a macroblock asdescribed above.

FIG. 3 is a diagram showing an example of labeled prediction samples inthe 4×4 luma prediction mode. Referring to FIG. 3 , a prediction block Pis A to H or I to L and is calculated on the basis of labeled samples.

FIGS. 4A to 4I are a diagram showing 9 kinds of prediction modes withinthe 4×4 luma prediction mode.

An encoder may select any one of the 9 prediction modes for each blockin order to minimize a difference between a prediction block P and ablock to be encoded. The 9 prediction modes are as follows.

1) mode 0 (vertical): A to D which are upper samples of the predictionblock are vertically extrapolated.

2) mode 1 (horizontal): I to L which are left samples of the predictionblock are horizontally extrapolated.

3) mode 2 (DC); all the samples A to D and I to L within the predictionblock P are predicted by average.

4) mode 3 (diagonal down-left): samples within the prediction block Pare interpolated at an angle of 45° between a left down and a right up.

5) mode 4 (diagonal down-right): samples within the prediction block Pare extrapolated right downward at an angle of 45°.

6) mode 5 (vertical-right): samples within the prediction block P areextrapolated or interpolated to the right at an angle of about 26.6° ina vertical axis.

7) mode 6 (horizontal-down): samples within the prediction block P areextrapolated downward at an angle of about 26.6° in a horizontal axis.

8) mode 7 (vertical-left): samples within the prediction block P areextrapolated to the left at an angle of about 26.6° in the verticalaxis.

9) mode 8 (horizontal-up): samples within the prediction block P areinterpolated upward at an angle of about 26.6° in the horizontal axis.

In FIGS. 4A to 4I, the arrow indicates a direction in which predictionis performed within each mode. Meanwhile, in relation to the mode 3 tothe mode 8, the samples within the prediction block P are formed from aweighted average of the prediction samples A to H or I to L. Forexample, in the mode 4, a sample d placed on the right upper side of theprediction block P may be predicted as round (B/4+C/2+D/4). The encodercalculates the Sum of Absolute Errors (SAE) for a prediction blockgenerated by each of the prediction modes and performs intra-predictionbased on the prediction mode having the smallest SAE.

FIG. 5 is a diagram showing an example of a method of applying a filterbefore intra-prediction is performed.

In general, a filter is applied to samples used in the H. 264/AVCstandard, and intra-prediction is then performed. The samples may alsobe called reference pixel values. In the example of FIG. 5 , it isassumed that a filter is a low-pass filter and is applied to only an 8×8block.

Equation 1 is an example of Equation showing a 3-tap filter applied to areference pixel value.

$\begin{matrix}{{{h\lbrack Z\rbrack} = {( {A + {2 \times Z} + Q} )/4}}{{h\lbrack A\rbrack} = {( {Z + {2 \times A} + B} )/4}}\ldots{{h\lbrack P\rbrack} = {( {O + {3 \times P}} )/4}}{{h\lbrack Q\rbrack} = {( {Z + {2 \times Q} + R} )/4}}\ldots{{h\lbrack X\rbrack} = {( {W + {3 \times X}} )/4}}} & \langle {{Equation}1} \rangle\end{matrix}$

h[Z] indicates a value calculated by applying the filter to Z. Referringto Equation 1, filtering for the reference pixel value is performed byapplying filter coefficients (1,2,1), and intra-prediction according tothe 9 prediction modes is performed on the basis of reference pixelvalues h[A]˜h[Z] that has been filtered. Like in the encoding process,the filter may be applied even in a decoding process.

In performing filtering before intra-prediction is performed, theperformance of encoding may be improved when the filtering is notperformed. Accordingly, a method of performing intra-prediction byadaptively applying the filter may be proposed.

FIG. 6 is a diagram showing an embodiment of the proposed method ofperforming intra-prediction using an adaptive filter.

Referring to FIG. 6 , at step S201, an encoder determines whether toapply the adaptive filter to a reference pixel value. When determiningwhether to apply the adaptive filter, the encoder may determine whetherto apply the adaptive filter on the basis of information about asurrounding block or according to a Rate-Distortion Optimization (RDO)method.

When determining whether to apply the adaptive filter to the referencepixel value based on the information about a surrounding block, aprediction mode of a current block may be determined based on predictionmode information (i.e., a Most Probable Mode (MPM) about the surroundingblock, and whether to apply the adaptive filter to the reference pixelvalue may be determined according to the determined prediction mode ofthe current block. For example, assuming that a current block is ‘C’, anupper block is ‘A’, and a left block is ‘B’, when a prediction mode ofthe current block is the same as a prediction mode of the upper block‘A’, the prediction mode of the upper block ‘A’ may be determined as theprediction mode of the current block. When the prediction mode of thecurrent block is the same as a prediction mode of the left block ‘B’,the prediction mode of the left block ‘B’ may be determined as theprediction mode of the current block. Alternatively, when the predictionmode of the current block is a prediction mode other than the predictionmode of the upper block ‘A’ or the prediction mode of the left block‘B’, a relevant prediction mode is encoded and transmitted. Whether toapply the adaptive filter to the reference pixel value may be determinedaccording to the prediction mode of the current block determined asdescribed above. Even when the current block, the upper block, and theleft block have different sizes, the prediction mode of a current blockmay be determined based on the prediction mode of a surrounding block.

Alternatively, in determining whether to apply the adaptive filter tothe reference pixel value based on the information about a surroundingblock, whether to apply the adaptive filter may be determined on thebasis of a shift in the surrounding reference pixel value. For example,assuming that a reference pixel value to which the filter will beapplied is p[n], a difference between p[n−1] and p[n+1] (i.e.,surrounding reference pixel values) may be calculated, and whether toapply the filter may be determined by comparing the difference with aspecific threshold.

Alternatively, whether to apply the filter to the reference pixel valuemay be determined based on the size of a current block other than aprediction mode of the current block. Here, whether to apply the filteris previously designated based on the prediction mode of the currentblock and the size of the current block, and whether to apply the filteris adaptively determined according to the relevant prediction mode orthe relevant size.

Table 1 indicates whether to apply the filter according to theprediction mode of a current block and the size of the current block.

TABLE 1 PREDICTION MODE OF CURRENT SIZE OF CURRENT BLOCK BLOCK 4 × 4 8 ×8 16 × 16 32 × 32 0 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 1 1 1 1 4 0 1 1 1 . .. . . . . . . . . . . . .

Referring to Table 1, ‘0’ indicates that the filter is not applied, and‘1’ indicates that the filter is applied. For example, when the size ofthe current block is 4×4, if the prediction mode of the current block is1, the filter may not be applied. If the prediction mode of the currentblock is 3, the filter may be applied.

Furthermore, whether to apply the filter to the reference pixel valuemay be determined according to whether surrounding blocks have beensubjected to intra-frame encoding or inter-frame encoding. For example,when constrained intra-prediction is performed, a value subjected to theinter-frame encoding is filled with the value of a surrounding blocksubjected to intra-frame encoding when the surrounding block issubjected to the inter-frame encoding. Here, filter may not be applied.

If, as a result of the determination, the filter is determined to beapplied to the reference pixel value, the encoder applies the filter tothe reference pixel value at step S202. The applied filter may be acommon filter. For example, the 3-tap filter of Equation 1 may be used,or a 2-tap filter may be used. When the 2-tap filter is used, variousfilter coefficients, such as (1/8, 7/8), (2/8, 6/8), and (3/8, 5/8), maybe used. The reference pixel value to which the filter has been appliedmay be used when the filter is applied to other reference pixel values.Furthermore, when the filter is applied to the reference pixel value,the filter may be applied to all reference pixel values or only some ofthe reference pixel values.

At step S203, the encoder performs intra-prediction on the basis of thereference pixel value to which the filter has been applied or to whichthe filter has not been applied.

At step S204, the encoder determines whether to apply the filter to aprediction value for each prediction mode, predicted by performing theintra-prediction, in order to encode a current block. Here, eachprediction mode may be each of the 9 prediction modes in the 4×4 lumaprediction mode. When determining whether to apply the filter to aprediction value for each prediction mode, whether to apply the filtermay be determined based on information about a surrounding block oraccording to the RDO method.

When determining whether to apply the filter to the prediction valuebased on the information about a surrounding block, a prediction mode ofthe current block may be determined based on prediction mode information(MPM) about the surrounding block, and whether to apply the filter tothe prediction value may be determined based on the determinedprediction mode of the current block. For example, assuming that acurrent block is ‘C’, an upper block is ‘A’, and a left block is ‘B’,when a prediction mode of the current block is the same as a predictionmode of the upper block ‘A’, the prediction mode of the upper block ‘A’may be determined as the prediction mode of the current block. When theprediction mode of the current block is same as a prediction mode of theleft block ‘B’, the prediction mode of the left block ‘B’ may bedetermined as the prediction mode of the current block. Alternatively,when the prediction mode of the current block is a prediction mode otherthan the prediction mode of the upper block ‘A’ or the prediction modeof the left block ‘B’, a relevant prediction mode is encoded andtransmitted. Here, when the prediction mode of the current block is aspecific prediction mode (DC or planar), a difference between areference pixel value and a prediction value may be relatively greaterthan that of other prediction modes. For example, a difference between areference pixel value and a prediction value in the planar predictionmode may be relatively greater than that of other prediction modes. Theprediction value in the planar prediction mode may be calculated byaveraging a first prediction value, obtained by horizontally performinglinear interpolation for each row, and a second prediction valueobtained by vertically performing linear interpolation for each column.When the linear interpolation is horizontally performed, a right valueis the same as a value placed at a right upward position (i.e., D inFIG. 3 ), from among the reference pixel values. When the linearinterpolation is vertically performed, a downward value is the same as avalue placed at a left downward position (i.e., L in FIG. 3 ), fromamong the reference pixel values. Since the prediction value is notdirectly obtained from the reference pixel value, a difference betweenthe reference pixel value and the prediction value may be relativelygreat. In this case, intra-prediction efficiency may be increased byapplying the filter to the prediction value. Whether to apply the filterto the prediction value may be determined according to the predictionmode of the current block determined as described above. Even when acurrent block, an upper block, and a left block have different sizes, aprediction mode of the current block may be determined according to theprediction mode of a surrounding block.

Alternatively, whether to apply the filter to the prediction value maybe determined according to the size of a current block besides theprediction mode of a current block. Here, whether to apply the filteraccording to the prediction mode of the current block and the size ofthe current block is previously designated, and whether to apply thefilter is adaptively determined according to the relevant predictionmode or the relevant size. Alternatively, whether to apply the filter tothe prediction value may be determined according to whether surroundingblocks have been subjected to intra-frame encoding or inter-frameencoding.

If, as a result of the determination, the filter is determined to havebeen applied to the prediction value, the encoder applies the filter tothe prediction value at step S205. Accordingly, the prediction of thecurrent block is completed, and the encoder calculates a residual signaland performs entropy coding.

FIG. 7 is a diagram showing an example in which the filter is applied tothe prediction value according to the proposed method of performingintra-prediction using the adaptive filter.

Referring to FIG. 7 , in the case where the prediction mode of a currentblock is a non-directional mode, a difference between a reference pixelvalue and a prediction value may become relatively greater than that ofother prediction modes. Accordingly, the filter may be applied to onlythe prediction values of pixels adjacent to the boundary withsurrounding restored reference pixel values. For example, filtering maybe performed for prediction values corresponding to a1˜a8, and b1, c1,d1, e1, f1, g1, and h1 corresponding to the pixels of one line which isplaced at the boundary in FIG. 7 . Alternatively, filtering may beperformed for prediction values corresponding to a1˜a8, b1˜b8, andc1˜c2, d1˜d2, e1˜e2, f1˜f2, g1˜g2, and h1˜h2 corresponding to the pixelsof two lines which are placed at the boundary in FIG. 7 . Here, theapplied filter may be a common filter. For example, the 3-tap filter ofEquation 1 may be used or a 2-tap filter may be used. When the 2-tapfilter is used, various filter coefficients, such as (1/8, 7/8), (2/8,6/8), and (3/8, 5/8), may be used. Alternatively, any one of the 2-tapfilter and the 3-tap filter may be selected and sued according to thepositions of pixels.

In the case where the prediction mode of a current block is a predictionmode using the reference pixel values corresponding to A-P as in themode 0, the mode 3, or the mode 7 in this way, the filter may be appliedto prediction values which correspond to a1˜a8 having a relatively greatdifference between the reference pixel value and the prediction value.Furthermore, in the case where the prediction mode of a current block isa prediction mode using the reference pixel values corresponding to Q-Xas in the mode 1 or the mode 8, the filter may be applied to predictionvalues which correspond to a1, b1, c1, d1, e1, f1, g1, and h1 having arelatively great difference between the reference pixel value and theprediction value.

Equation 2 is an example of Equation, indicating the filter applied toprediction values when the 2-tap filter or the 3-tap filter is selectedand used according to the positions of pixels.

$\begin{matrix}{{{f\lbrack {a1} \rbrack} = {( {{2 \times A} + {4 \times a1} + {2 \times Q}} )/8}}{{f\lbrack {b1} \rbrack} = {( {{2 \times B} + {6 \times b1}} )/8}}{{f\lbrack {c1} \rbrack} = {( {{2 \times C} + {6 \times c1}} )/8}}\ldots{{f\lbrack {a2} \rbrack} = {( {{2 \times R} + {6 \times a2}} )/8}}{{f\lbrack {a3} \rbrack} = {( {{2 \times S} + {6 \times a3}} )/8}}\ldots} & \langle {{Equation}2} \rangle\end{matrix}$

In Equation 2, f[a1] is a value in which the filter is applied to theprediction value a1, and A and Q indicate the reference pixel values.From Equation 2, it can be seen that the 3-tap filter is applied to theprediction value of a pixel where the prediction value a1 is placed, andthe 2-tap filter is applied to the prediction values of remainingpixels.

Equation 3 is another example of Equation, indicating the filter appliedto prediction values when the filter is applied to the prediction valuesaccording to the proposed method of performing intra-prediction usingthe adaptive filter.

$\begin{matrix}{{{1.{Vertical}{low}}‐{{pass}{filter}}}{{v\lbrack {a1} \rbrack} = {( {A + {2 \times a1} + {a2}} )/4}}{{v\lbrack {a2} \rbrack} = {( {{v\lbrack {a1} \rbrack} + {2 \times a2} + {a3}} )/4}}\ldots{{v\lbrack {a8} \rbrack} = {( {{v\lbrack {a7} \rbrack} + {3 \times a8}} )/4}}{{v\lbrack {b1} \rbrack} = {( {B + {2 \times b1} + {b2}} )/4}}\ldots{{2.{Horizontal}{low}}‐{{pass}{filter}}}{{h\lbrack {a1} \rbrack} = {( {Q + {2 \times {v\lbrack {a1} \rbrack}} + {v\lbrack {b1} \rbrack}} )/4}}{{h\lbrack {b1} \rbrack} = {( {{h\lbrack {a1} \rbrack} + {2 \times {v\lbrack {b1} \rbrack}} + {v\lbrack {c1} \rbrack}} )/4}}\ldots{{h\lbrack {h1} \rbrack} = {( {{h\lbrack {g1} \rbrack} + {3 \times {v\lbrack {h1} \rbrack}}} )/4}}{{h\lbrack {a2} \rbrack} = {( {R + {2 \times {v\lbrack {a2} \rbrack}} + {v\lbrack {b2} \rbrack}} )/4}}\ldots} & \langle {{Equation}3} \rangle\end{matrix}$

In Equation 3, the filter may be used when the adaptive filter isapplied according to the method using information about surroundingblocks or the RDO method for each of the prediction modes. Referring toEquation 3, a low-pass filter having filter coefficients (1, 2, 1) issequentially applied to two vertical and horizontal directions. First,the filter is applied to the vertical direction, and the filter isapplied to the horizontal direction based on a prediction value to whichthe filter has been applied. The prediction value to which the filterhas been applied may be used when the filter is applied to otherprediction values.

Meanwhile, when the RDO method is used, the method of performingintra-prediction described with reference to FIG. 6 may be repeatedlyperformed.

FIG. 8 is a block diagram of an encoder and a decoder in which theembodiments of the present invention are implemented.

The encoder 800 includes a processor 810 and memory 820. The processor810 implements the proposed functions, processes, and/or methods. Theprocessor 810 is configured to determine whether to apply a first filterto reference pixel values based on information about surrounding blocksof a current block, apply the first filter to the reference pixel valuesif, as a result of the determination, the first filter is determined tobe applied, perform intra-prediction for the current block on the basisof the reference pixel values, determine whether to apply a secondfilter to a prediction value for each prediction mode of the currentblock which has been predicted by performing the intra-prediction basedon the information about surrounding blocks, and apply the second filterto the prediction value for each prediction mode of the current blockif, as a result of the determination, the second filter is determined tobe applied. The memory 820 is connected to the processor 810 and isconfigured to store various pieces of information for driving theprocessor 810.

The decoder 900 includes a processor 910 and memory 920. The processor910 implements the proposed functions, processes, and/or methods. Theprocessor 910 is configured to determine whether to apply a first filterto reference pixel values based on information about surrounding blocksof a current block, apply the first filter to the reference pixel valuesif, as a result of the determination, the first filter is determined tobe applied, perform intra-prediction for the current block on the basisof the reference pixel values, determine whether to apply a secondfilter to a prediction value for each prediction mode of the currentblock which has been predicted by performing the intra-prediction basedon the information about surrounding blocks, and apply the second filterto the prediction value for each prediction mode of the current blockif, as a result of the determination, the second filter is determined tobe applied. The memory 920 is connected to the processor 910 and isconfigured to store various pieces of information for driving theprocessor 910.

The processor 810, 910 may include Application-Specific IntegratedCircuits (ASICs), other chipsets, logic circuits, and/or dataprocessors. The memory 820, 920 may include Read-Only Memory (ROM),Random Access Memory (RAM), flash memory, a memory card, a storagemedium, and/or other storage devices. When the above embodiments areimplemented in software, the above schemes may be implemented using amodule (or a process or function) for performing the above functions.The module may be stored in the memory 820, 920 and may be executed bythe processor 810, 910. The memory 820, 920 may be internal or externalto the processor 810, 910 and may be coupled to the processor 810, 910using a variety of well-known means.

In the above-described exemplary systems, although the methods have beendescribed on the basis of the flowcharts using a series of steps orblocks, the present invention is not limited to the sequence of thesteps, and some of the steps may be performed at different sequencesfrom the remaining steps or may be performed simultaneously with theremaining steps. Furthermore, those skilled in the art will understandthat the steps shown in the flowcharts are not exclusive and other stepsmay be included or one or more steps of the flowcharts may be deletedwithout affecting the scope of the present invention.

The above-described embodiments include various aspects ofillustrations. Although all kinds of possible combinations forrepresenting the various aspects may not be described, a person havingordinary skill in the art will understand that other possiblecombinations are possible. Accordingly, the present invention may besaid to include all other replacements, modifications, and changesbelonging to the accompanying claims.

What is claimed is:
 1. A video decoding method, comprising: determiningwhether to apply a first filter for a reference pixel value of a currentblock based on at least one of an intra prediction mode of the currentblock and a size of the current block; deriving a prediction value ofthe current block using the reference pixel value; and determiningwhether to apply a second filter for the prediction value of the currentblock based on at least one of an intra prediction mode of the currentblock and a size of the current block, for thereby producing a filteredprediction value, and wherein when the intra prediction mode of thecurrent block is a vertical mode, the filtered prediction value isgenerated by applying the second filter for leftmost pixels of thecurrent block among prediction pixels of the current block adjacent tothe reference pixel value.
 2. The video decoding method of claim 1,wherein when the intra prediction mode of the current block is thevertical mode, the second filter is applied by using an upper referencepixel value, left reference pixel values and an upper-left cornerreference pixel value, the upper reference pixel value corresponding toan upper-side of an upper-leftmost pixel of the current block, the leftreference pixel values corresponding to left-sides of the leftmostpixels of the current block.
 3. A video encoding method comprising:encoding information related to whether to apply a first filter for areference pixel value of a current block and whether to apply a secondfilter for a prediction value of the current block, wherein theinformation is related to at least one of an intra prediction mode ofthe current block and a size of the current block, and wherein when theintra prediction mode of the current block is a vertical mode, afiltered prediction value is generated by applying the second filter forleftmost pixels of the current block among prediction pixels of thecurrent block adjacent to the reference pixel value.
 4. A non-transitorycomputer-readable storage medium storing a bitstream, the bitstreamcomprising: information related to whether to apply a first filter for areference pixel value of a current block and whether to apply a secondfilter for a prediction value of the current block, wherein theinformation is related to at least one of an intra prediction mode ofthe current block and a size of the current block, and wherein when theintra prediction mode of the current block is a vertical mode, afiltered prediction value is generated by applying the second filter forleftmost pixels of the current block among prediction pixels of thecurrent block adjacent to the reference pixel value.